﻿// *----------------------------------------------------------------
// Copyright (C) 2017 通通优品
// 版权所有。
// 
// 类名：IApiContext.cs
// 功能描述：TongTongMall.MallWeb.ApiRepository
// 
// Create User：jym 2017/02/28
// 
// Edit User：UserName,EditTime
// Describe：Describe
// ----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace TongTongMall.MallWeb.ApiRepository.Domain
{
    public interface IApiContext
    {
        /// <summary>
        /// 参数按照application/x-www-form-urlencoded传递
        /// </summary>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="url"></param>
        /// <param name="httpContents">参数</param>
        /// <param name="contentType">数据传输格式</param>
        /// <returns></returns>
        Task<TResult> PostAsync<TResult>(string url, IDictionary<string, StringContent> httpContents, Type TResultType = null) where TResult : class;

        /// <summary>
        /// post url 返回值
        /// </summary>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="url"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        Task<TResult> PostAsync<TResult>(string url, int? timeout = null) where TResult : class, new();

        /// <summary>
        /// post url 返回值
        /// </summary>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="url"></param>
        /// <param name="input"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        Task<TResult> PostAsync<TResult>(string url, object input, int? timeout = null) where TResult : class, new();
    }
}
